#!/bin/bash
username="$1"
DATE=$(date +%F)
while true;do
   if who|grep "^$username" >/dev/null;then
	break
   fi
   sleep 3
done
echo "${DATE} $username is logged on" >> /tmp/user.log
